﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace nSin.TaskSwitcher
{
    [ValueConversion(typeof(TabItemMetaData), typeof(string))]
    public class TaskSwitcherTextConverter : IValueConverter
    {

        #region " Methods "

        public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {

            TabItemMetaData obj = (nSin.TaskSwitcher.TabItemMetaData)value;

            if (obj.InstanceCount == 0)
            {
                return obj.TabHeader;
            }

            else
            {
                return string.Format("{0} ({1})", obj.TabHeader, obj.InstanceCount.ToString());
            }

        }

        public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();

        }

        #endregion

    }


}
